package com.example.demo.ReentrantLock锁.condition;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * @description:
 * @projectName:demo
 * @see:ReentrantLock锁.condition
 * @author:袁成龙
 * @createTime:2020/10/9 13:25
 * @version:1.0
 */
public class TestCondition2 implements Runnable{

    private Condition condition;
    private Lock lock;

    public TestCondition2(Condition condition, Lock lock) {
        this.condition = condition;
        this.lock = lock;
    }

    @Override
    public void run() {
        lock.lock();
        try {
            System.out.println("===========执行二");
            condition.signal();
        } finally {
            lock.unlock();
        }

    }
}